package com.lt.ssm.controller;

import com.lt.ssm.domain.User;
import com.lt.ssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/showUser/{id}")
    public String findByIId(@PathVariable("id") Integer id, Model model){
        User user = userService.findById(id);

        model.addAttribute("user", user);

        return "/info";
    }
}

